package util;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.SwingConstants;

import util.components.buttons.JButtonMenu;
import view.JanelaPrincipal;

public class PanelBotao extends javax.swing.JPanel{

	private javax.swing.JButton btn_menu[][];

	public PanelBotao(JanelaPrincipal jan, String str_submenu[][]){
		super();
		//BoxLayout layoute = new BoxLayout(this, BoxLayout.X_AXIS);
		//setLayout(layoute);

		this.setAlignmentX(SwingConstants.CENTER);
		this.setAlignmentY(SwingConstants.CENTER);

		Eventos e = new Eventos();
		btn_menu = new JButtonMenu[str_submenu.length][];
		for(int i = 0; i < str_submenu.length; i++) {
			btn_menu[i] = new JButtonMenu[str_submenu[i].length];
			for(int j = 0; j < str_submenu[i].length; j++) {
				btn_menu[i][j] = new JButtonMenu(jan, i, j, str_submenu[i][j]);
				btn_menu[i][j].setFocusPainted(false);
				btn_menu[i][j].addActionListener(e);
				this.add(btn_menu[i][j]);				
			}
		}
	}

	public void setPanelBotao(int indice_lateral) {
		removeAll();
		for(int i = 0; i < btn_menu[indice_lateral].length; i++) {
			this.add(btn_menu[indice_lateral][i]);
		}
	}

	public JButton[][] getBtn() {
		return btn_menu;
	}	
}

